package com.hjj.services;

import com.hjj.beans.User;
import com.hjj.exception.LoginException;
import com.hjj.mapper.UserMapper;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service("userServicesImp")
public class UserServicesImp implements UserServices {
    @Autowired
    UserMapper userMapper;

    @Override
    public ArrayList<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    public User getByUser(String loginAct, String loginPwd){

        // 把密码使用MD5加密
        loginPwd = DigestUtils.md5Hex(loginPwd);

        return userMapper.getByUser(loginAct, loginPwd);
    }
}
